home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / alib / csup / rexx_support / storage.i < prev   
Encoding:
Text File  |  1995-12-24  |  10.0 KB  |  239 lines

  1.          IFND REXX_STORAGE_I
  2. REXX_STORAGE_I SET    1
  3. **
  4. **    $Id: storage.i,v 30.0 1994/06/10 18:10:50 dice Exp $
  5. **
  6. **    Include file for REXX data structures and memory/storage management.
  7. **
  8. **    (C) Copyright 1986,1987,1988,1989,1990 William S. Hawes.
  9. **        All Rights Reserved
  10. **
  11.  
  12.          IFND EXEC_TYPES_I
  13.          INCLUDE "exec/types.i"
  14.          ENDC
  15.  
  16.          IFND EXEC_NODES_I
  17.          INCLUDE "exec/nodes.i"
  18.          ENDC
  19.  
  20.          IFND EXEC_LISTS_I
  21.          INCLUDE "exec/lists.i"
  22.          ENDC
  23.  
  24.          IFND EXEC_PORTS_I
  25.          INCLUDE "exec/ports.i"
  26.          ENDC
  27.  
  28.          IFND EXEC_LIBRARIES_I
  29.          INCLUDE "exec/libraries.i"
  30.          ENDC
  31.  
  32. * The NexxStr structure is used to maintain the internal strings in REXX.
  33. * It includes the buffer area for the string and associated attributes.
  34. * This is actually a variable-length structure; it is allocated for a
  35. * specific length string, and the length is never modified thereafter
  36. * (since it's used for recycling).
  37.  
  38.          STRUCTURE NexxStr,0
  39.          LONG     ns_Ivalue            ; integer value
  40.          UWORD    ns_Length            ; length in bytes (excl null byte)
  41.          UBYTE    ns_Flags             ; attribute flags
  42.          UBYTE    ns_Hash              ; sum-of-characters hash code
  43.          STRUCT   ns_Buff,8            ; buffer area for strings
  44.          LABEL    NSMINSIZE            ; 16 bytes (minimum)
  45.  
  46. NXADDLEN EQU      ns_Buff+1            ; structure offset plus null byte
  47. IVALUE   EQU      ns_Ivalue            ; integer value
  48.  
  49. * String attribute flag bit definitions
  50. NSB_KEEP    EQU   0                    ; permanent string? (in Symbol Table)
  51. NSB_STRING  EQU   1                    ; string form valid?
  52. NSB_NOTNUM  EQU   2                    ; non-numeric?
  53. NSB_NUMBER  EQU   3                    ; a valid number?
  54. NSB_BINARY  EQU   4                    ; integer value saved?
  55. NSB_FLOAT   EQU   5                    ; floating point format?
  56. NSB_EXT     EQU   6                    ; an external string?
  57. NSB_SOURCE  EQU   7                    ; part of the program source?
  58.  
  59. * The flag form of the string attributes
  60. NSF_KEEP    EQU   1<<NSB_KEEP
  61. NSF_STRING  EQU   1<<NSB_STRING
  62. NSF_NOTNUM  EQU   1<<NSB_NOTNUM
  63. NSF_NUMBER  EQU   1<<NSB_NUMBER
  64. NSF_BINARY  EQU   1<<NSB_BINARY
  65. NSF_FLOAT   EQU   1<<NSB_FLOAT
  66. NSF_EXT     EQU   1<<NSB_EXT
  67. NSF_SOURCE  EQU   1<<NSB_SOURCE
  68.  
  69. * Combinations of flags
  70. NSF_INTNUM  EQU   (NSF_NUMBER!NSF_BINARY!NSF_STRING)
  71. NSF_DPNUM   EQU   (NSF_NUMBER!NSF_FLOAT)
  72. NSF_ALPHA   EQU   (NSF_NOTNUM!NSF_STRING)
  73. NSF_OWNED   EQU   (NSF_SOURCE!NSF_EXT!NSF_KEEP)
  74. KEEPSTR     EQU   (NSF_STRING!NSF_SOURCE!NSF_NOTNUM)
  75. KEEPNUM     EQU   (NSF_STRING!NSF_SOURCE!NSF_NUMBER!NSF_BINARY)
  76.  
  77. * The RexxArg structure is identical to the NexxStr structure, but
  78. * is allocated from system memory rather than from internal storage.
  79. * This structure is used for passing arguments to external programs.
  80. * It is usually passed as an "argstring", a pointer to the string buffer.
  81.  
  82.          STRUCTURE RexxArg,0
  83.          LONG     ra_Size              ; total allocated length
  84.          UWORD    ra_Length            ; length of string
  85.          UBYTE    ra_Flags             ; attribute flags
  86.          UBYTE    ra_Hash              ; hash code
  87.          STRUCT   ra_Buff,8            ; buffer area
  88.          LABEL    RexxArg_SIZEOF       ; size: 16 bytes
  89. ; Changed to RexxArg_SIZEOF from ra_SIZEOF
  90.  
  91. * The RexxMsg structure is used for all communications with Rexx programs.
  92. * It is an EXEC message with a parameter block appended.
  93.  
  94.          STRUCTURE RexxMsg,MN_SIZE
  95.          APTR     rm_TaskBlock         ; pointer to RexxTask structure
  96.          APTR     rm_LibBase           ; library pointer
  97.          LONG     rm_Action            ; command (action) code
  98.          LONG     rm_Result1           ; return code
  99.          LONG     rm_Result2           ; secondary result
  100.          STRUCT   rm_Args,16*4         ; argument block (ARG0-ARG15)
  101.          APTR     rm_PassPort          ; forwarding port
  102.          APTR     rm_CommAddr          ; host address (port name)
  103.          APTR     rm_FileExt           ; file extension
  104.          LONG     rm_Stdin             ; input stream
  105.          LONG     rm_Stdout            ; output stream
  106.          LONG     rm_avail             ; future expansion
  107.          LABEL    RMSIZEOF             ; size: 128 bytes
  108. ; Ranamed from rm_SIZEOF
  109.  
  110. * Field definitions
  111. ACTION   EQU      rm_Action            ; action code
  112. RESULT1  EQU      rm_Result1           ; primary return/error level
  113. RESULT2  EQU      rm_Result2           ; secondary return/result string
  114. ARG0     EQU      rm_Args              ; start of argblock
  115. ARG1     EQU      rm_Args+4            ; first argument
  116. ARG2     EQU      rm_Args+8            ; second argument
  117.  
  118. MAXRMARG EQU      15                   ; maximum arguments
  119.  
  120. * Command (action) codes for message packets
  121. RXCOMM   EQU      $01000000            ; a command-level invocation
  122. RXFUNC   EQU      $02000000            ; a function call
  123. RXCLOSE  EQU      $03000000            ; close the port
  124. RXQUERY  EQU      $04000000            ; query for information
  125. RXADDFH  EQU      $07000000            ; add a function host
  126. RXADDLIB EQU      $08000000            ; add a function library
  127. RXREMLIB EQU      $09000000            ; remove a function library
  128. RXADDCON EQU      $0A000000            ; add/update a ClipList string
  129. RXREMCON EQU      $0B000000            ; remove a ClipList string
  130. RXTCOPN  EQU      $0C000000            ; open the trace console
  131. RXTCCLS  EQU      $0D000000            ; close the trace console
  132.  
  133. * Command modifier flag bits
  134. RXFB_NOIO   EQU   16                   ; suppress I/O inheritance?
  135. RXFB_RESULT EQU   17                   ; result string expected?
  136. RXFB_STRING EQU   18                   ; program is a "string file"?
  137. RXFB_TOKEN  EQU   19                   ; tokenize the command line?
  138. RXFB_NONRET EQU   20                   ; a "no-return" message?
  139.  
  140. * Modifier flags
  141. RXFF_RESULT EQU   1<<RXFB_RESULT
  142. RXFF_STRING EQU   1<<RXFB_STRING
  143. RXFF_TOKEN  EQU   1<<RXFB_TOKEN
  144. RXFF_NONRET EQU   1<<RXFB_NONRET
  145.  
  146. RXCODEMASK  EQU   $FF000000
  147. RXARGMASK   EQU   $0000000F
  148.  
  149. * The RexxRsrc structure is used to manage global resources.
  150. * The name string for each node is created as a RexxArg structure,
  151. * and the total size of the node is saved in the "rr_Size" field.
  152. * Functions are provided to allocate and release resource nodes.
  153. * If special deletion operations are required, an offset and base can
  154. * be provided in "rr_Func" and "rr_Base", respectively.  This function
  155. * will be called with the base in register A6 and the node in A0.
  156.  
  157.          STRUCTURE RexxRsrc,LN_SIZE
  158.          WORD     rr_Func              ; "auto-delete" offset
  159.          APTR     rr_Base              ; "auto-delete" base
  160.          LONG     rr_Size              ; total size of node
  161.          LONG     rr_Arg1              ; available ...
  162.          LONG     rr_Arg2              ; available ...
  163.          LABEL    RRSIZEOF             ; size: 32 bytes
  164. ; Changed from rr_SIZEOF to RRSIZEOF
  165.  
  166. * Field definitions
  167. RRTYPE   EQU      LN_TYPE              ; node type
  168. RRNAME   EQU      LN_NAME              ; node name (argstring)
  169. RRSIZE   EQU      rr_Size              ; total size of node
  170.  
  171. * Resource node types
  172. RRT_ANY  EQU      0                    ; any node type ...
  173. RRT_LIB  EQU      1                    ; a function library
  174. RRT_PORT EQU      2                    ; a public port
  175. RRT_FILE EQU      3                    ; a file IoBuff
  176. RRT_HOST EQU      4                    ; a function host
  177. RRT_CLIP EQU      5                    ; a Clip List node
  178.  
  179. * The RexxTask structure holds the fields used by REXX to communicate with
  180. * external processes, including the client task.  It includes the global
  181. * data structure (and the base environment).  The structure is passed to
  182. * the newly-created task in its "wake-up" message.
  183.  
  184. GLOBALSZ EQU      200                  ; space for the Global Data structure
  185.  
  186.          STRUCTURE RexxTask,GLOBALSZ   ; global data structure
  187.          STRUCT   rt_MsgPort,MP_SIZE   ; message port
  188.          UBYTE    rt_Flags             ; task flag bits
  189.          BYTE     rt_SigBit            ; signal bit
  190.  
  191.          APTR     rt_ClientID          ; the client's task ID
  192.          APTR     rt_MsgPkt            ; the packet being processed
  193.          APTR     rt_TaskID            ; our task ID
  194.          APTR     rt_RexxPort          ; the REXX public port
  195.  
  196.          APTR     rt_ErrTrap           ; Error trap address
  197.          APTR     rt_StackPtr          ; stack pointer for traps
  198.  
  199.          STRUCT   rt_Header1,LH_SIZE
  200.          STRUCT   rt_Header2,LH_SIZE
  201.          STRUCT   rt_Header3,LH_SIZE
  202.          STRUCT   rt_Header4,LH_SIZE
  203.          STRUCT   rt_Header5,LH_SIZE
  204.          LABEL    rt_SIZEOF
  205.  
  206. ENVLIST  EQU      rt_Header1           ; environment list (internal)
  207. FREELIST EQU      rt_Header2           ; freelist (internal)
  208. MEMLIST  EQU      rt_Header3           ; allocation list (external)
  209. FILELIST EQU      rt_Header4           ; I/O files list (external)
  210. PORTLIST EQU      rt_Header5           ; message ports list (external)
  211. NUMLISTS EQU      5
  212.  
  213. * Definitions for RexxTask flag bits
  214. RTFB_TRACE  EQU      0                 ; external trace flag
  215. RTFB_HALT   EQU      1                 ; external halt flag
  216. RTFB_SUSP   EQU      2                 ; suspend task?
  217. RTFB_TCUSE  EQU      3                 ; trace console in use?
  218. RTFB_WAIT   EQU      6                 ; waiting for reply?
  219. RTFB_CLOSE  EQU      7                 ; task completed?
  220.  
  221. * Definitions for memory allocation constants
  222. MEMQUANT EQU      16                   ; quantum of memory space
  223. MEMMASK  EQU      $FFFFFFF0            ; mask for rounding the size
  224.  
  225. MEMQUICK EQU      (1<<0)               ; EXEC flags: MEMF_PUBLIC
  226. MEMCLEAR EQU      (1<<16)              ; EXEC flags: MEMF_CLEAR
  227.  
  228. * The SrcNode is a temporary structure used to hold values destined for a
  229. * segment array.  It is also used to maintain the memory freelist.
  230.  
  231.          STRUCTURE SrcNode,0           ; temporary source data structure
  232.          APTR     sn_Succ
  233.          APTR     sn_Pred
  234.          APTR     sn_Ptr               ; pointer value
  235.          LONG     sn_Size              ; size of object
  236.          LABEL    sn_SIZEOF            ; size: 16 bytes
  237.  
  238.          ENDC
  239.